home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-08-26 | 820 b | 38 lines | [TEXT/KAHL] |
- /*******
- * HandleMouse()
- *
- * Checks the cursor position and calls MousePos if necessary
- *
- *******/
-
- HandleMouse(boundsRect)
- Rect *boundsRect;
- {
- Point mousePoint;
- Point newPoint;
-
- GetMouse(&mousePoint);
- LocalToGlobal(&mousePoint);
-
- newPoint.h = newPoint.v = -1;
-
- if (mousePoint.h <= boundsRect->left)
- newPoint.h = boundsRect->right - 2;
- else
- if (mousePoint.h >= boundsRect->right - 1)
- newPoint.h = boundsRect->left + 1;
- if (mousePoint.v <= boundsRect->top)
- newPoint.v = boundsRect->bottom - 2;
- else
- if (mousePoint.v >= boundsRect->bottom - 1)
- newPoint.v = boundsRect->top + 1;
-
- if ( (newPoint.h + 1) || (newPoint.v + 1) )
- {
- newPoint.h = (newPoint.h != -1) ? newPoint.h : mousePoint.h;
- newPoint.v = (newPoint.v != -1) ? newPoint.v : mousePoint.v;
-
- MousePos(newPoint);
- }
- }
-